<?php

namespace app\admin\validate;

use think\Validate;

/**
 * 今日热议验证器
 * @package app\admin\validate
 */
class TodayHot extends Validate
{
    // 定义验证规则
    protected $rule = [
        'id|ID' => 'require',
        'title|标题' => 'require|unique:admin_today_hot',
        'content|内容详情' => 'require',
        'hot|热度值' => 'require',
    ];

    // 定义验证提示
    protected $message = [
        'id.require' => 'ID必须',
        'title.require' => '请输入标题',
        'title.unique' => '该标题已存在',
        'content.require' => '请输入内容详情',
        'hot.require' => '请输入热度值',
    ];

    // 定义验证场景
    protected $scene = [
        // 添加
        'insert' => ['title', 'content', 'hot'],
        //更新
        'edit' => ['id', 'title', 'content', 'hot'],
    ];
}
